package week04.homework01MazeGame.model.item;

import week04.homework01MazeGame.model.role.Player;

/**
 * @author li
 */
public class Equipment extends BaseItem {

    private final String name;

    private final int attackBonus;

    private final int defenseBonus;

    public Equipment(String name, int attackBonus, int defenseBonus) {
        this.name = name;
        this.attackBonus = attackBonus;
        this.defenseBonus = defenseBonus;
    }

    @Override
    public String getName() {
        return this.name;
    }

    @Override
    public void use(Player player) {
        player.addAttack(this.attackBonus);
        player.addDefense(this.defenseBonus);
    }

    @Override
    public String getDescription() {
        return "攻击力：" + attackBonus + ", 防御力：" + defenseBonus;
    }
}
